<!--
/* Powered by JYWAP & jy.qhxin.com */
var pageSize = 5;
var userItem = new Array();
var userNode = new Array();
var LoadedCids = new Array();

function getUserNode() {
	if (xmlHttp.readyState==4) {
		var userList = eval("("+xmlHttp.responseText+")");
		var user = new Array();
		var htmlStr = "";
		if(checkValidOk(userList)) {
			var uid = "";
			for(i=0;i<userItem.length;i++) {
				user = userList["user-uid-"+userNode[i]];
				htmlStr = "<img src=\""+user["headphoto"]+"\" height=\"30\" width=\"30\" class=\"middle\"> "+user["name"]+": ";
				$("useritem"+userItem[i]).innerHTML = htmlStr;
			}
		}
		userItem = [];
		userNode = [];
	}
}
function getSubView() {
	if (xmlHttp.readyState==4) {
		var subViewList = eval("("+xmlHttp.responseText+")");
		var subView = new Array();
		var htmlStr = "";
		if(checkValidOk(subViewList)) {
			var uid = "";
			for(i=0;i<SubViewFids.length;i++) {
				htmlStr = "";
				subView = subViewList["comm-cid-"+SubViewFids[i]];
				var isMore = inArray(SubViewFids[i],LoadedCids,false);
				if(!isMore) htmlStr += "<div class=\"box left subbox\">";
				for(j=0;j<subView.length;j++) {
					if(j==(subView.length-1)){
						htmlStr += "<div class=\"l\" id=\"last"+SubViewFids[i]+"\">";
					}else{
						htmlStr += "<div class=\"l2\">";
					}
					userItem.push(subView[j]["rid"]);
					userNode.push(subView[j]["uid"]);
					uid += subView[j]["uid"] + "_";
					htmlStr += "<span class=\"grey\">"+subView[j]["time"]+"</span><br/><span id=\"useritem"+subView[j]["rid"]+"\"></span>"+ subView[j]["content"]+"</div>";
				}
				if(SubViewTj[SubViewFids[i]] > SubViewPage[SubViewFids[i]]*pageSize) htmlStr += "<input type=\"button\" class=\"sbutton\" id=\"subviewmore"+SubViewFids[i]+"\" value=\"查看更多..\" onclick=\"tokenSubInit("+SubViewFids[i]+");\"/>";
				SubViewPage[SubViewFids[i]]++;
				if(!isMore) htmlStr += "</div>";
				if(isMore) {
					$("subviewmore"+SubViewFids[i]).outerHTML = htmlStr;
					$("last"+SubViewFids[i]).outerHTML = "<div class=\"l2\">" + $("last"+SubViewFids[i]).innerHTML+ "</div>";
				}else{
					LoadedCids.push(SubViewFids[i]);
					$("subview"+SubViewFids[i]).innerHTML = htmlStr;
				}
			}
			if(uid!="") {
				getJsonData("index.php?app-uiduser-token-"+ajaxToken+"-uid-"+uid+".htm", getUserNode);
			}
		}
		SubViewFids = [];
	}
}

function getToken() {
	if (xmlHttp.readyState==4) {
		ajaxToken = eval("("+xmlHttp.responseText+")");
		if(ajaxToken!="") {
			cid = "";
			for(i=0;i<SubViewFids.length;i++) {
				if(!inArray(SubViewFids[i],LoadedCids,false))
					$("subview"+SubViewFids[i]).innerHTML = "<div class=\"box left subbox\">层聊加载中...</div>";
				cid += SubViewFids[i] + "_";
			}
			if(cid!=""){
				start = (SubViewPage[SubViewFids[0]]-1)*pageSize;
				getJsonData("index.php?app-cidsublist-token-"+ajaxToken+"-cid-"+cid+"-order-1-start-"+start+"-limit-"+pageSize+".htm", getSubView);
			}
		}
	}
}
function tokenSubInit(cid) {
	if(cid!=null) SubViewFids.push(cid);
	getJsonData("index.php?app-token-key-"+CS_KEY+".htm", getToken);
}
tokenSubInit();
-->